

module Schnell
  class Frame
    include Schnell::Container
    def initialize(page,how,what)
      @page = page
      @how = how
      @what = what
    end
    def locate
      case @how
        when :name
          @element = @page.getFrameByName(@what)
        when :index
          @element = @page.getFrames[@what - 1]
      end
    end
    def assert_exists
      locate
      raise UnknownFrameException if @element.nil?
      return @element.getEnclosedPage
    end
  end
end
